/* GUI CONVERTED from sopirp1a.p (converter v1.75) Sat Aug 12 17:26:43 2000 */
/* sopirp1a.p - PRICING HISTORY REPORT BY SALES ORDER LINES             */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                  */
/* All rights reserved worldwide.  This is an unpublished work.         */
/* web convert sopirp1a.p (converter v1.00) Fri Oct 10 13:57:21 1997 */
/* web tag in sopirp1a.p (converter v1.00) Mon Oct 06 14:17:48 1997 */
/*J11K*/ /*K0W7*/ /*                                                    */
/*V8:ConvertMode=FullGUIReport                                 */
/* REVISION: 8.5      LAST MODIFIED: 03/30/95   BY: tjm *J042*          */
/* REVISION: 8.5      LAST MODIFIED: 07/19/95   BY: DAH *J05K*          */
/* REVISION: 8.5      LAST MODIFIED: 07/28/95   BY: DAH *J063*          */
/* REVISION: 8.5      LAST MODIFIED: 06/13/96   BY: DAH *J0T0*          */
/* REVISION: 8.5      LAST MODIFIED: 07/09/96   BY: *J0XD* Rob Wachowicz*/
/* REVISION: 8.5      LAST MODIFIED: 07/25/96   BY: *J11K* Jean Miller  */
/* REVISION: 8.6      LAST MODIFIED: 10/13/97   BY: GYK *K0W7*          */

/* REVISION: 8.6E     LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane */
/* REVISION: 8.6E     LAST MODIFIED: 10/04/98   BY: *J314* Alfred Tan   */
/* REVISION: 9.1      LAST MODIFIED: 03/24/00   BY: *N08T* Annasaheb Rahane */
/* REVISION: 9.1      LAST MODIFIED: 08/12/00   BY: *N0KN* myb              */


/*GUI global preprocessor directive settings */
&GLOBAL-DEFINE PP_PGM_RP TRUE
&GLOBAL-DEFINE PP_ENV_GUI TRUE


/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

         {mfdeclre.i}
         {gplabel.i} /* EXTERNAL LABEL INCLUDE */

/* ********** Begin Translatable Strings Definitions ********* */

&SCOPED-DEFINE sopirp1a_p_1 "Qty Open"
/* MaxLen: Comment: */

/* ********** End Translatable Strings Definitions ********* */

/*K0W7*/ {wbrp02.i}

         define shared variable sonbr       like so_nbr.
         define shared variable sonbr1      like so_nbr.
         define shared variable socust      like so_cust.
         define shared variable socust1     like so_cust.
         define shared variable sobill      like so_bill.
         define shared variable sobill1     like so_bill.
         define shared variable soship      like so_ship.
         define shared variable soship1     like so_ship.
         define shared variable soorddate   like so_ord_date.
         define shared variable soorddate1  like so_ord_date.
         define shared variable soprdate    like so_priced_dt.
         define shared variable soprdate1   like so_priced_dt.
         define shared variable soduedate   like sod_due_date.
         define shared variable soduedate1  like sod_due_date.

         define variable qty_open        like sod_qty_ord label {&sopirp1a_p_1}.
/*J0XD*  define variable amt_type        like pih_amt_type. */
/*J0XD*  define variable source          like pih_source.   */
/*J0XD*/ define variable amt_type like pih_amt_type format "x(12)".
/*J0XD*/ define variable source   like pih_source   format "x(12)".
         define variable order_header    like mfc_logical.

         {mfphead.i}

         for each so_mstr
            where so_nbr        >= sonbr     and so_nbr       <= sonbr1
              and so_cust       >= socust    and so_cust      <= socust1
              and so_bill       >= sobill    and so_bill      <= sobill1
              and so_ship       >= soship    and so_ship      <= soship1
              and so_priced_dt  >= soprdate  and so_priced_dt <= soprdate1
              and so_ord_date   >= soorddate and so_ord_date  <= soorddate1
             /*fdn*/ AND LOOKUP(so_site, GLOBAL_user_site) > 0
/*J05K*/    no-lock:

            order_header = no.

            for each sod_det
               where sod_nbr = so_nbr
                 and ((sod_due_date >= soduedate
                        and sod_due_date <= soduedate1)
                     or  (soduedate = low_date and soduedate1 = hi_date
/*J05K*/                   and sod_due_date = ?)) no-lock:

               find first pt_mstr where pt_part = sod_part
                          no-lock no-error.

               /* PRINT HEADER */
               if not order_header then do:
                  find ad_mstr no-lock where ad_addr = so_cust.
                  order_header = yes.
                  if so_curr = base_curr then do with frame ax:
                     /* SET EXTERNAL LABELS */
                     setFrameLabels(frame ax:handle).
                     display sod_nbr so_cust ad_name so_bill so_ship
                        so_ord_date so_due_date so_priced_dt so_po
/*J11K                     with frame a width 132. */
/*J11K*/             with frame ax width 132 STREAM-IO /*GUI*/ .
                  end. /* if so_curr = base_curr then */
                  else  do with frame  b:
                     /* SET EXTERNAL LABELS */
                     setFrameLabels(frame b:handle).
             display sod_nbr so_cust ad_name so_bill so_ship
                        so_ord_date so_due_date so_priced_dt so_po
                        so_curr with frame b width 132 STREAM-IO /*GUI*/ .
                  end. /* else */
           end.

/*J0XD*/       qty_open = sod_qty_ord - sod_qty_ship.

/*J0XD*/       if available pt_mstr then do with frame c:
                  /* SET EXTERNAL LABELS */
                  setFrameLabels(frame c:handle).
                  /* PRINT DETAIL */
                  display
/*J0XD*              space(3) */
/*J0XD*/             space(2)
                     sod_line sod_part pt_break_cat qty_open
/*J0T0**             sod_list_pr sod_disc_pct sod_price sod_qty_ord */
/*J0XD* /*J0T0*/     sod_list_pr sod_disc_pct format "->>>9.99" sod_price */
/*J0XD*/             sod_list_pr format "->>>>,>>>,>>9.99<<<"
/*J0XD*/             sod_disc_pct format "->>>9.99"
/*J0XD*/             sod_price format "->>>>,>>>,>>9.99<<<"
/*J0T0*/             sod_qty_ord
                     sod_pricing_dt sod_due_date
                  with frame c width 132 no-attr-space down STREAM-IO /*GUI*/ .
         end. /* if available pt_mstr */

               for each pih_hist
/*J05K*/          no-lock
/*J063*/          where pih_doc_type = 1
                    and pih_nbr      = sod_nbr
                    and pih_line     = sod_line
                  by pih_feature by pih_option by pih_amt_type
                  by pih_source with frame d:

                  find first lngd_det
                     where lngd_dataset = "pi_mstr"
                       and lngd_field   = "pi_amt_type"
                       and lngd_lang    = global_user_lang
                       and lngd_key1    = pih_amt_type
                     no-lock no-error.
                  if lngd_mnemonic <> "" then
                      amt_type = lngd_mnemonic.
                  else
                      amt_type = lngd_translation.

                  find first lngd_det
                     where lngd_dataset = "pih_hist"
                       and lngd_field   = "pih_source"
                       and lngd_lang    = global_user_lang
                       and lngd_key1    = pih_source
                     no-lock no-error.
                  if lngd_mnemonic <> "" then
                     source = lngd_mnemonic.
                  else
                     source = lngd_translation.

                  /* SET EXTERNAL LABELS */
                  setFrameLabels(frame d:handle).
                  display
/*J0XD*              space(6)  */
/*J0XD*/             space(2)
                     pih_list pih_qty pih_break_cat
                     amt_type source pih_amt pih_disc_amt pih_option
                     pih_confg_disc
                  with frame d width 132 no-attr-space down STREAM-IO /*GUI*/ .
               end. /* for each pih_hist */

            end. /* for each sod_det */

            
/*GUI*/ {mfguirex.i } /*Replace mfrpexit*/


         end. /* for each so_mstr */

         /* If none printed, display put to get report heading */
         if line-counter = 1 then put " ".
/*K0W7*/ {wbrp04.i}
